// File AbstractLocation.h
//
// Purpose: abstract base class to define an interface for a state
//
// Author : Bryson King (edited)
// Original Code Provided by: Mat Buckland 2002 (fup@ai-junkie.com)
// Date : 18 March 2013
// --------------------------------------------------------------
#ifndef ABSTRACTLOCATION_H
#define ABSTRACTLOCATION_H

#include <map>
#include <string>

#include "Item.h"

class IPerson;
struct Telegram;

class CLocation
{
public:
	CLocation();
	virtual ~CLocation();

	//this will execute when the location is entered
	virtual void Enter(IPerson*) = 0;

	//this will execute each time the location machine updates
	virtual void Execute(IPerson*) = 0;

	//this will execute when the location is exited. 
	virtual void Exit(IPerson*) = 0;

	//this executes if the agent receives a message from the 
	//message dispatcher
	virtual bool OnMessage(IPerson*, const Telegram&) = 0;

	virtual CItems* RetrieveItemsAtLocation() = 0;

	//request user input to determine where to go next
	virtual SItem* RequestUserInput(IPerson*, std::string&, IPerson*&) = 0;
	virtual CLocation** RequestDirectionsPossible(int&) = 0;

	virtual void AddEntityToLocation(IPerson* entity);
	virtual void RemoveEntityFromLocation(IPerson* pEntity);
	virtual IPerson* RetrieveEntity(int index);
	virtual IPerson** RetrieveAllEnemies(IPerson*, int&);
	virtual int NumberOfPeopleAtLocation();

private:
	struct entity_node
	{
		entity_node* next;
		IPerson* entity;
	};

	entity_node* m_pHeadOfList;
	entity_node* m_pTailOfList;
	int m_iNumberOfPeopleInLocation;
};

#endif